package com.atguigu.crowd.api;

import java.util.List;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import com.atguigu.crowd.entity.po.MemberPO;
import com.atguigu.crowd.entity.vo.AddressVO;
import com.atguigu.crowd.entity.vo.DetailProjectVO;
import com.atguigu.crowd.entity.vo.MemberLauchInfoVO;
import com.atguigu.crowd.entity.vo.OrderProjectVO;
import com.atguigu.crowd.entity.vo.OrderVO;
import com.atguigu.crowd.entity.vo.PortalProjectVO;
import com.atguigu.crowd.entity.vo.PortalTypeVO;
import com.atguigu.crowd.entity.vo.ProjectVO;
import com.atguigu.crowd.entity.vo.TagVO;
import com.atguigu.crowd.entity.vo.TypeVO;
import com.atguigu.crowd.util.ResultEntity;
import com.github.pagehelper.PageInfo;

@FeignClient("atguigu-crowd-mysql")
public interface MySQLRemoteService {
	/**
	 * 保存项目
	 * @param projectVO
	 * @param memberId
	 * @return
	 */
	@RequestMapping("/save/project/vo/remote")
	ResultEntity<String> saveProjectVORemote(@RequestBody ProjectVO projectVO,@RequestParam("memberId") Integer memberId);
	/**
	 * 获取会员
	 * @param loginAcct
	 * @return
	 */
	@RequestMapping("/get/memberpo/by/loginacct/remote")
	ResultEntity<MemberPO> getMemberPOByLoginAcctRemote(@RequestParam("loginAcct") String loginAcct);
	/**
	 * 保存会员
	 * @param memberPO
	 * @return
	 */
	@RequestMapping("/save/member/remote")
	public ResultEntity<String> saveMember(@RequestBody MemberPO memberPO);
	/**
	 * 获取首页项目
	 * @return
	 */
	@RequestMapping("/get/portal/type/project/data/remote")
	ResultEntity<List<PortalTypeVO>> getPortalTypeProjectDataRemote();

	/**
	 * 获取项目详情
	 * @param projectId
	 * @return
	 */
	@RequestMapping("/get/project/detail/remote/{projectId}")
	ResultEntity<DetailProjectVO> getDetailProjectVORemote(@PathVariable("projectId") Integer projectId);
	/**
	 * 获取发起人信息
	 * @param projectId
	 * @return
	 */
	@RequestMapping("/get/launch/info/vo/remote/{projectId}")
	ResultEntity<MemberLauchInfoVO> getLaunchInfoVORemote(@PathVariable("projectId") Integer projectId);
	/**
	 * 获取项目订单，包括回报的内容，级联查询
	 * @param returnId
	 * @return
	 */
	@RequestMapping("/get/order/project/vo/remote")
	ResultEntity<OrderProjectVO> getOrderProjectVORemote(@RequestParam("returnId") Integer returnId);
	/**
	 * 获取地址信息
	 * @param memberId
	 * @return
	 */
	@RequestMapping("/get/address/vo/remote")
	ResultEntity<List<AddressVO>> getAddressVORemote(@RequestParam("memberId") Integer memberId);
	
	/**
	 * 添加地址信息
	 * @param addressVO
	 * @return
	 */
	@RequestMapping("/save/address/vo/remote")
	ResultEntity<String> saveAddressVORemote(@RequestBody AddressVO addressVO);
	/**
	 * 保存订单信息，级联保存订单项目信息
	 * @param orderVO
	 * @return
	 */
	@RequestMapping("/save/order/vo/remote")
	ResultEntity<String> saveOrderVORemote(@RequestBody OrderVO orderVO,@RequestParam("memberId") Integer memberId);
	/**
	 * 获取我发布的项目
	 * @param memberId
	 * @return
	 */
	
	@RequestMapping("/get/launch/project/remote")
	ResultEntity<List<DetailProjectVO>> getLaunchProjectRemote(@RequestParam("memberId") Integer memberId);
	
	/**
	 * 查询我支持的订单项目列表
	 * @param memberId
	 * @return
	 */
	@RequestMapping("/get/order/project/remote")
	ResultEntity<List<OrderProjectVO>> getOrderProjectRemote(@RequestParam("memberId") Integer memberId);
	/**
	 * 查询项目分类
	 * @return
	 */
	@RequestMapping("/get/project/type/vo/remote")
	ResultEntity<List<TypeVO>> getProjectTypeVORemote();
	/**
	 * 查询项目标签
	 * @return
	 */
	@RequestMapping("/get/project/tag/vo/remote")
	ResultEntity<List<TagVO>> getProjectTagVORemote();
	/**
	 * 查看订单详情
	 * @param orderId
	 * @return
	 */
	@RequestMapping("/show/order/detail/remote")
	ResultEntity<OrderProjectVO> showOrderDetailRemote(@RequestParam("orderId") Integer orderId);
	/**
	 * 删除订单
	 * @param orderId
	 * @return
	 */
	@RequestMapping("/del/order/detail/remote")
	ResultEntity<String> delOrderDetailRemote(@RequestParam("orderId") Integer orderId);
	/**
	 * 查看我发起的项目详情
	 * @param projectId
	 * @return
	 */
	@RequestMapping("/show/project/detail/remote")
	ResultEntity<DetailProjectVO> showProjectDetailRemote(@RequestParam("projectId") Integer projectId);
	/**
	 * 删除我发起的项目
	 * @param orderId
	 * @return
	 */
	@RequestMapping("/del/project/detail/remote")
	ResultEntity<String> delProjectDetailRemote(@RequestParam("projectId") Integer projectId);
	/**
	 * 更新我支持的项目
	 * @param projectId
	 * @return
	 */
	@RequestMapping("/edit/project/detail/remote")
	ResultEntity<String> editProjectDetailRemote(@RequestBody DetailProjectVO detailProjectVO,@RequestParam("projectId") Integer projectId);
	
	/**
	 * 用es分页查询项目
	 * @param pageNum
	 * @param pageSize
	 * @param keyword
	 * @return
	 */
	@RequestMapping("/show/projects/remote")
	PageInfo<PortalProjectVO> showProjectsRemote(
			@RequestParam("pageNum") Integer pageNum,
			@RequestParam("pageSize") Integer pageSize,
			@RequestParam("keyword") String keyword);
	/**
	 * 根据分类id分页查询项目
	 * @param pageNum
	 * @param pageSize
	 * @param keyword
	 * @param typeId
	 * @return
	 */
	@RequestMapping("/show/projects/by/typeid/remote")
	PageInfo<PortalProjectVO> showProjectByTypeIdRemote(
			@RequestParam("pageNum") Integer pageNum,
			@RequestParam("pageSize") Integer pageSize,
			@RequestParam("keyword") String keyword,
			@RequestParam("typeId") Integer typeId);
	/**
	 * 根据状态分页查询项目
	 * @param pageNum
	 * @param pageSize
	 * @param keyword
	 * @param typeId
	 * @return showProjectByStatusRemote(pageNum,pageSize,keyword,status);
	 */
	@RequestMapping("/show/projects/by/status/remote")
	PageInfo<PortalProjectVO> showProjectByStatusRemote(
			@RequestParam("pageNum") Integer pageNum,
			@RequestParam("pageSize") Integer pageSize,
			@RequestParam("keyword") String keyword,
			@RequestParam("status") Integer status);
	/**
	 * 根据排序条件分页查询项目
	 * @param pageNum
	 * @param pageSize
	 * @param keyword
	 * @param factor 条件标识
	 * @return
	 */
	@RequestMapping("/show/projects/order/by/status/remote")
	PageInfo<PortalProjectVO> showProjectOrderByRemote(
			@RequestParam("pageNum") Integer pageNum, 
			@RequestParam("pageSize") Integer pageSize, 
			@RequestParam("keyword") String keyword,
			@RequestParam("factor") String factor);

	
}
